﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace HZ.Supervise.Web.Secondphase.ReportHospital
{
    public partial class HospitalPurchaseChange : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                cblMonth.Visible = false;
                Databing();
            }
        }
        public void Databing()
        {

            DataTable dt = new DataTable();
            DataColumn dc1 = new DataColumn("hospital", typeof(string)); dt.Columns.Add(dc1);
            //DataColumn dc2 = new DataColumn("PurchaseNumerbTotalc", typeof(string)); dt.Columns.Add(dc2);
            DataColumn dc2 = new DataColumn("PurchaseNumerbTotalc_jb", typeof(string)); dt.Columns.Add(dc2);
            DataColumn dc3 = new DataColumn("PurchaseNumerbTotalc_fjb", typeof(string)); dt.Columns.Add(dc3);
            // DataColumn dc5 = new DataColumn("PurchaseAmountTotal", typeof(string)); dt.Columns.Add(dc5);
            DataColumn dc4 = new DataColumn("PurchaseAmountTotal_jb", typeof(string)); dt.Columns.Add(dc4);
            DataColumn dc5 = new DataColumn("PurchaseAmountTotal_fjb", typeof(string)); dt.Columns.Add(dc5);
            //DataColumn dc8 = new DataColumn("LastMonthRanked", typeof(string)); dt.Columns.Add(dc8);
            // DataColumn dc9 = new DataColumn("RankedChange", typeof(string)); dt.Columns.Add(dc9);

            DataColumn dc6 = new DataColumn("PurchaseNumerbTotalc_jb1", typeof(string)); dt.Columns.Add(dc6);
            DataColumn dc7 = new DataColumn("PurchaseNumerbTotalc_fjb1", typeof(string)); dt.Columns.Add(dc7);
            // DataColumn dc5 = new DataColumn("PurchaseAmountTotal", typeof(string)); dt.Columns.Add(dc5);
            DataColumn dc8 = new DataColumn("PurchaseAmountTotal_jb2", typeof(string)); dt.Columns.Add(dc8);
            DataColumn dc9 = new DataColumn("PurchaseAmountTotal_fjb2", typeof(string)); dt.Columns.Add(dc9);
            for (int i = 0; i < 10; i++)
            {
                DataRow dr = dt.NewRow();
                dr[0] = "昆明地市" + i.ToString();
                dr[1] = "1000";
                dr[2] = "300";
                dr[3] = "600";
                dr[4] = "90000.000";
                dr[5] = "20000.000";
                dr[6] = "70000.00";
                dr[7] = "60000.00";
                dr[8] = "40000.00";
                dt.Rows.Add(dr);
            }

            gvwHospitalSales.DataSource = dt;
            gvwHospitalSales.DataBind();
        }
        //动态变换表头
        protected void gvwHospitalSales_RowCreated(object sender, GridViewRowEventArgs e)
        {
            switch (e.Row.RowType)
            {
                case DataControlRowType.Header:

                    //取得下拉框的月份


                    //第一行表头
                    TableCellCollection tcHeader = e.Row.Cells;
                    tcHeader.Clear();
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[0].Attributes.Add("colspan", "1"); //跨Row
                    tcHeader[0].Attributes.Add("bgcolor", "LightSteelBlue");
                    //tcHeader[0].Attributes.Add("bgcolor", "white");
                    tcHeader[0].Text = "";
                    //tcHeader.Add(new TableHeaderCell());
                    //tcHeader[1].Attributes.Add("bgcolor", "Red");
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[1].Attributes.Add("colspan", "3"); //跨Column
                    tcHeader[1].Text = "1月";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[2].Attributes.Add("colspan", "3"); //跨Column
                    tcHeader[2].Text = "2月";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[3].Attributes.Add("colspan", "3"); //跨Column
                    tcHeader[3].Text = "3月";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[4].Attributes.Add("colspan", "2"); //跨Column
                    tcHeader[4].Text = "</th></tr><tr>";



                    //第2行表头
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[5].Attributes.Add("bgcolor", "LightSteelBlue");
                    tcHeader[5].Text = "";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[6].Attributes.Add("bgcolor", "LightSteelBlue");
                    tcHeader[6].Attributes.Add("colspan", "3");
                    tcHeader[6].Text = "采购趋势变化【25%】";

                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[7].Attributes.Add("bgcolor", "LightSteelBlue");
                    tcHeader[7].Attributes.Add("colspan", "3");
                    tcHeader[7].Text = "采购趋势变化【26%】";

                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[8].Attributes.Add("bgcolor", "LightSteelBlue");
                    tcHeader[8].Attributes.Add("colspan", "3");
                    tcHeader[8].Text = "采购趋势变化【27%】";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[9].Attributes.Add("bgcolor", "LightSteelBlue");
                    tcHeader[9].Attributes.Add("colspan", "2");
                    tcHeader[9].Text = "</th></tr><tr>";

                    //第3行表头
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[10].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[10].Text = "医院名称";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[11].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[11].Text = "上月份采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[12].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[12].Text = "本月采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[13].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[13].Text = "下月份采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[14].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[14].Text = "上月份采购总金额";

                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[15].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[15].Text = "本月采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[16].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[16].Text = "下月份采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[17].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[17].Text = "上月份采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[18].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[18].Text = "本月采购总金额";
                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[19].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[19].Text = "下月份采购总金额";

                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[20].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[20].Text = "操作";

                    tcHeader.Add(new TableHeaderCell());
                    tcHeader[21].Attributes.Add("bgcolor", "Khaki");
                    tcHeader[21].Text = "图表</th></tr><tr>";
                    break;
            }
        }

        protected void btnMonthClick(object sender, EventArgs e)
        {
            cblMonth.ClearSelection();
            cblMonth.Visible = true;
            txtMonth.Text = "";
        }

        protected void btnCancelMonth_Click(object sender, EventArgs e)
        {
            for (int i = 0; i < cblMonth.Items.Count; i++)
            {
                if (cblMonth.Items[i].Selected == true)
                {
                    txtMonth.Text += cblMonth.Items[i].Text + "|";
                }
            }

            cblMonth.Visible = false;
        }

        protected void Button1_Click(object sender, EventArgs e)
        {

        }

        protected void btnExcel_Click(object sender, EventArgs e)
        {

        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {

        }

        protected void lbtnSee_Click(object sender, EventArgs e)
        {

        }
    }
}
